//#include <QGuiApplication>
#include "qtquickcontrolsapplication.h"
#include <QQmlApplicationEngine>
#include <QtQuick/QQuickWindow>
#include <QtCore/QUrl>
#include <qqmlcontext.h>
#include "./View/mainquo.h"
#include <QDebug>
#include <QtSql>
extern "C"{
#include <openssl/applink.c>
}
//#include <map>
int main(int argc, char *argv[])
{
#if defined(Q_OS_WIN)
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif

//    std::map<QString, QString> mmp;
//    QString qsStr = "client_name=孙小目seat_id｜cust_id｜∧005831ˇ1005235837∧";
//    QStringList qL = qsStr.split("∧");
//    for(int i = 0; i < qL.size(); ++i)
//    {
//       qDebug()<<"qsStr:"<<qL.at(i);
//    }

//    QGuiApplication app(argc, argv);
//    QTcpSocket *tcpClient;

//    tcpClient = new QTcpSocket(this);   //实例化tcpClient
    QtQuickControlsApplication app(argc, argv);     //工具栏按钮有鼠标划入效果 lqh
    QQmlApplicationEngine engine;

    qmlRegisterType<TreeModel>("com.View.TreeModel", 1, 0, "TreeModel");
    qmlRegisterType<CColumnConfig>("CColumnConfig", 1, 0, "CColumnConfig");
    qmlRegisterType<FileConfig>("com.FileConfig", 1, 0, "FileConfig");
    qmlRegisterType<ColumnListModel>("com.ColumnListModel",1,0,"ColumnListModel");
    qmlRegisterType<AlmListModel>("com.AlmListModel",1,0,"AlmListModel");
    qmlRegisterType<RspInterface>("com.RspInterface", 1, 0, "RspInterface");
    qmlRegisterType<ComboData>("com.ComboData", 1, 0, "ComboData");
    qmlRegisterType<QStringListModel>("com.QStringListModel", 1, 0, "QStringListModel");

    QQmlContext *context = engine.rootContext();
    MainQuo mainQuo;
    context->setContextProperty("g_MainQuo", &mainQuo);
    context->setContextProperty("colCfg", mainQuo.GetColumnConfig());
    context->setContextProperty("config", mainQuo.GetFileConfig());
    app.setWindowIcon(QPixmap(":/Res/image/ylink_logo.png"));   //依赖#include <QtQuick/QQuickWindow>

    mainQuo.SetEngine(&engine, &app);
//#define DEBUG_NOLOGIN
#ifdef DEBUG_NOLOGIN
    mainQuo.ShowMainWnd();
#else
    mainQuo.ShowLogin();
#endif
    //test
//    mainQuo.ShowMainWnd();
//    engine.load(QUrl(QStringLiteral("qrc:/Res/qml/login.qml")));
//    app.exec();

//    if (Global::Instance()->m_bLogSuccess)
//    {
//        mainQuo.ShowMainWnd();
//        engine.load(QUrl(QStringLiteral("qrc:/Res/qml/main.qml")));
//        if (engine.rootObjects().isEmpty())
//            return -1;

//        app.exec();
//    }
    return 0;
}
